#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<int,int> x,pair<int,int> y){

    return x.first<y.first;
}
int main(){
    int c;cin>>c;
    vector<pair<int,int>>nums(c);
    for(int i=0;i<c;i++){
        cin>>nums[i].first;
        nums[i].second = i+1;
    }
    
    sort(nums.begin(),nums.end(),cmp);
    double ans = 0;
    for(auto n:nums){
        cout<<n.second<<" ";
        //s等待时间
        double k = n.first*--c;
        ans+=k;
    }
    cout<<endl;
    ans /= nums.size();
    cout<<fixed<<setprecision(2)<<ans;
    return 0;
}